package com.jxsd.edu.cn.struts2.serviceImpl;

import java.util.List;

import com.jxsd.edu.cn.struts2.dao.AttributeDao;
import com.jxsd.edu.cn.struts2.daoImpl.AttributeDaoImpl;
import com.jxsd.edu.cn.struts2.models.Attributes;
import com.jxsd.edu.cn.struts2.services.AttributeService;

public class AttributeServiceImpl implements AttributeService 
{
    private   AttributeDao  dao=new  AttributeDaoImpl();
	
	@Override
	public List<Attributes> getAttributes(String smallName,String  catagoryName) 
	{
		List<Attributes>  smalls=dao.getSmallAttributes(smallName);
		List<Attributes>  catas=dao.getCataAttributes(catagoryName);
		
		if(catas.size()>0&&smalls.size()>0)
		for(Attributes  attr:smalls)
		{
			catas.add(attr);
		}
		if(catas.size()==0)
		{
			catas=smalls;
		}
		
		return catas;
	}
   
    
}
